package com.modifiertech.lineage.network;

import com.modifiertech.lineage.Lineage;
import io.netty.buffer.ByteBuf;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

/**客户端 技能 skillJumpSplash 事件
 *
 * 客户端响应消息
 *
 * @description: default
 * @author: saliencemn
 * @mail: hackingmu@outlook.com
 * @date: 2024/9/12 22:35
 */
public class MessageClientSkillJumpSplash implements IMessage, IMessageHandler<MessageClientSkillJumpSplash,IMessage> {
    private NBTTagCompound nbtTagCompound=new NBTTagCompound();

    @Override
    public void fromBytes(ByteBuf byteBuf) {
        nbtTagCompound= ByteBufUtils.readTag(byteBuf);
    }

    @Override
    public void toBytes(ByteBuf byteBuf) {
        ByteBufUtils.writeTag(byteBuf,nbtTagCompound);
    }


    @Override
    public IMessage onMessage(MessageClientSkillJumpSplash message, MessageContext messageContext) {
        Lineage.proxy.handleMessageClientSkillJumpSplash(message,messageContext);
        return null;
    }

    //构造客户端消息内容nbt
    public synchronized MessageClientSkillJumpSplash write(BlockPos playerPos){
        //INIT
        this.getNbtTagCompound().setDouble("x",playerPos.getX());
        this.getNbtTagCompound().setDouble("y",playerPos.getY());
        this.getNbtTagCompound().setDouble("z",playerPos.getZ());
        return this;
    }


    public NBTTagCompound getNbtTagCompound() {
        return nbtTagCompound;
    }

    public void setNbtTagCompound(NBTTagCompound nbtTagCompound) {
        this.nbtTagCompound = nbtTagCompound;
    }
}
